home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Toolbox / Visual Basic Toolbox (P.I.E.)(1996).ISO / codefmtr / vbcln / vbclean.frm (.txt) < prev    next >
Visual Basic Form  |  1992-05-16  |  6KB  |  118 lines

  1. VBClean
  2. VB Clean
  3. Form1
  4. cmdSave
  5. &Save/Load
  6. FindWindow
  7. lpClassName
  8. lpWindowName
  9. GetActiveWindow
  10. GetWindowText
  11. lpString
  12.     nMaxChars
  13. SetActiveWindow~
  14. Window_Captionn
  15. RtnLen
  16. WndCaption
  17. Active_Window_Caption
  18. cmdSave_Click
  19. cmdSave_Click_proc
  20. FileName
  21. ProjectName
  22. LastFileName
  23. VBhWnd
  24. this_dir
  25. VB_Class_Name
  26. Design_Window_Caption
  27. Abort_if_caption_is_not
  28. default_filename
  29. FilaName
  30. MB_ICONSTOP
  31. MB_OK
  32. captionn
  33.  The cmdSave_Click_Proc does most of the work in this program.
  34.  Refer to it for an explanation of how the program works.g
  35.  David Hitee
  36.  Compuserve ID: 72130,2400
  37. Userr
  38. Window_Caption
  39.   Initialize a string for an API call-
  40.   Get Window caption
  41.   Strip Chr$(0)d
  42. Active_Window_Caption
  43. cmdSave_Click
  44. cmdSave_Click_proc
  45.  This program works by saving the name of the last file in the project
  46.  window, then going to the first file in the project
  47.  window and doing a save/load on each file in thee
  48.  project.  It stops after doing the last file.  At each step, it
  49.  compares the caption of the active window to the one it expects and
  50.  aborts if they don't match.
  51. wndclass_desked_gsk"
  52. Microsoft Visual Basic [design]"
  53.  Make sure VB is running before we do anything
  54.  And make sure it's the active windowi
  55.  Save the current directory name.  We will use it explicitly to save/load3
  56.  each text file, since form and module files in different directoriesl
  57.  confuse the save/load process sometimes.l
  58.  Now compose the fully qualified filename to use for each save/load.
  59.  We use the same filename each time to avoid generating lots ofl
  60.  unnecessary txt files.m
  61. vbclean.txt"
  62.  Make sure that the Design Window is not minimized.  The following is
  63.  the only way that I've been able to guarantee this, since the API
  64.  functions IsIconic and OpenIcon do not appear to work correctly for
  65.     ' Visual Basic for some reason.
  66. %wp{Home}{Enter}
  67.  Find out the name of the last form or module in the project windowr
  68.  Go to the project windowt
  69.  Save the project name
  70. {END}"
  71.  Move to last file
  72.  open code windowi
  73.   Save the name of the last file
  74.  The active window is still the project window, which means that
  75.  F7 did not open the code window, so this entry 
  76.  is not a module or a form.  It's most likely a custom control.t
  77.  Anyway, whatever it is, we can't and don't want to do a save/load
  78.  for this file, so get the previous one.
  79.  Now we know the name of the last form or module in the project.
  80.  Go back to the first file in the project window.i
  81.  Close the code window
  82.  Go back to the project window
  83. {HOME}
  84.  Go to the first file 
  85.  Now loop through each file in the project, doing a save/load for each
  86.  Open code windowt
  87.  Get the module name
  88.  The active window is still the project window, which means that
  89.  F7 did not open the code window, therefore this entry
  90.  is not a module or a form.  Skip it.r
  91.  Code|Save
  92. Save Text"$
  93.  Enter the filename to save 
  94. {ENTER}"
  95.  Save txt file
  96. Microsoft Visual Basic
  97.  It's asking us if we want to replace an existing text file.  Say yes.
  98. {ENTER}"
  99.  Code|Load
  100. Load Text"$
  101.  Enter filename & Click "Replace" 
  102.  Code Menu|Close
  103.  Open the project window
  104. Expected Project Window.  Program Stopped.
  105. {DOWN}
  106.  Go to the next file
  107.  Now delete the text file that we were using in the save/load process.
  108. Visual Basic [Design] is not running."
  109. Nothing done."
  110. VBhWnd
  111. Abort_if_caption_is_not
  112.  If the caption of the currently active window does not
  113.  match the "caption" parameter, stop this program.  It means
  114.  that we have an unexpected window displayed.g
  115. Expected: 
  116. Found: "
  117. Program stopped.
  118.